package jianzhi_offer;

import java.util.Stack;

public class _19_包含min函数的栈 {
	Stack<Integer> ele = new Stack<Integer>();
	Stack<Integer> min = new Stack<Integer>();
	public void push(int node) {
        ele.add(node);
        if(!min.isEmpty()&&node > min.peek()) min.add(min.peek());
        else min.add(node);
    }
    
    public void pop() {
        ele.pop();
        min.pop();
    }
    
    public int top() {
        return ele.peek();
    }
    
    public int min() {
        return min.peek();
    }
}
